cleanup
update error handling