Rather than looping through `resultset` twice, just do it once.