Calculation works. Needs tidying up.