Factored error messages into a new function.
Uncommented a line that was commented for debugging.