Refactor some classes to improve score