Calculation done. Outsourced some of the mathematical stuff to nice little methods
Merge TFS Changeset 1827