Remove duplicated code, refactor
Remove duplicated code, refactor