Add documentation, clean up code, error reporting
Clean up readme