Shorten by merging conditional and query.