added array formatting function