Improve error handling and error messaging

Yea, we probably want that.
I'll fix