refactor array creation