array refactor