refactor the last 4 lines