more math and fixes