refactor code 3