Ann: First implementations of checkCluster and checkNeighbor. Implemented helper contains and updated isValid.