Updated error controller, error logging, and fixed a few bugs.