refactor for less code