add clustering function.