deep copies tables for query operations
removed circular dependency