Fixed the code, implemented try/except statements

This finishes the framework, now to add more calculations.