Added error reporting to Elements endpoint. Small modifications to Server and MainHandler.