Factored out calculations into calc.py