improved the update method. The maths was a pain in the ass and is still needs improvement