cleaned up math some