Defined functions for calculator.