Added error and exception handlers.
General improvement of error reporting in all places.
Things now throw exceptions instead of returning arrays, etc.
Logging on errors in framework