To array function updated

Faster array building