Better error handling for API.
Clean up output and inline comments
Spelling correction.