Revert "Revert "changes to maths""

This reverts commit 1f2dd28cd3546adcb122569e8012bc5ef5858c3d.