Added a testLoop function in Cluster.java to facilitate loop checking.