Improved exception handling (WIP)