Query chunking and Logout

Expands the simple query method to handle larger queries.  Returns as a generator.

Also added logout method (with local/global option)