Rough initial version of dem calculator
Restructuring calculation code to be a little cleaner