Refactor query engine to have two interchangeable parts.