Policy clustering code