Replace sequence with toArray