Hotfix/calc refactor

fixes issues we've had with sandboxing on prod and edge by restructuring the calc package.

@nedbat 
@cpennington