refactor code second