Corrected math.
Tied GUI to calculations.
Rudimentary saving into file.