Cleanup

Fixed the error function so that it would send the correct case and
changed the error output a little.

The rest was mostly just cleaning up minor things within the code.