Bug fixes, improved error handling,  improved documentation