refactor code 1