Clean array flatten using reduce.