refactor code and increment score