some more functionality.. finshing up the maths