A little more cleanup of query conditions