added option to input flat array so no flattenign required