Refactoring to use regular arrays