Added working error handling to calculator