work in progress on error handling restructuring