Added clustering code.