Initial code refactoring for scoring.

A category for scoring should be considered if any new code is added for scoring.