Refactored to use inject to get to total