refactoring adding to empty arr