Moved error handler to class, added debug constant