Add logging and errorhandlers