Extraction of write_query and read_query methods.