cleaned up calculateTotal breakout