added error-reporting, and some more