Improved error handling. Added to method documentation.