Refactored a lot of code. Ready to finish score function.