Improved error handling, a note on bugs.