Rehashing query to be a little more efficient