Day two clustering code