added some maths in