refactor score method