better error handling and examples