Refactoring arrays