Cleaned up some of the responsibilities of classes and some of the maths. Verified as working.