update clustering code