feat: refactor of Array (#5452)

This is a second attempt at #5446, first reverting parts of #5403.
7 files changed