Fixed the messages and massive if/else try/catch and bracket errors
which were causing the error page to crash.