Possible exceedingly ugly implementation of Join