write versions of join and collect