Small improvement in join code