refactored the arithmetic operations code