nested array allocation
remove unnecessary code