added compact array function