Get rid of unnecessary queries