added some math and things to update