The calc function now throws an exception instead of returning a null value. Included more documentation with commentary.