Cleaned up math