Updated calculator.

Some functionality has been reworked.