Returns the array in addition to modifying it