A bit less repeated code, replaced by a for loop.