Cleanup error handling, more docs