reorganize into readers and writers, move querying back into query module