Updated documentation and error handling