Improved error handling, broken everything else.