a little bit of refactoring to calculator
get rid of try...catch