I cleaned up some of the code (refactoring etc).

I also added the logic for the cluster comparison in the comments. My next step is to implement this logic.