Rewritten input for queries (now OK)