some modifications to calculator logic