Refactoring into arrays