added peeling for nested arrays