This code is repeated enough it seems like it would be better in a let block.