refactored calc2