Removes distinct queries