fixed coordinate math and formatting