Improved Error Handling

fixes #5