clean up error handling and logging
update example