Refactored calculator to use inject