implemented some maths functions