Refactor array