Laid the foundations for JoinAlgorithm (doesn't work currently).