Works, but not tested much

Basic calculations and updating of screen works. Have not fully tested
for bugs and problems. Looking to write functions that cut down the
amount of code that is repeated.