Performed final checks and tweaked some of the maths.