Added detect_cluster function to utils