array refactoring