Rewrote assign-array to use reduce as well