clean unnecessary nested arrays