WIP: Improving error handling