refactored array problems