refactor array input