Refactoring the calculator.js