Added documentation and Best-effort querying
Fixed TypeError in sys.stdout.write