flatten and join