use array instead of generator