more array refactoring