updating with better example and error handling