Added instructions to query handling, and smarter saving of queries