Updated error handling, documentation