refactor calculator model