refactor scoring logic into method