added functionality to detect bad clusters, orphans still not working 100%.