Staging

Major changes:
* Better error reporting
* small bug fixes