refactored for clever metaprogramming, thanks jason! also split the Calculator class off into its own lib