I feel like this math could be simplified