Added a bunch of Error checking to the calculations

Most of these errors should never come up since we will be providing
our own limited input method, but oh well.

Feel free to stress test this if you want, but since this is all
well beyond the scope of the project anyway, I wouldn't worry about it