added few comments to make it easy for polina; also identified the big white whale of a bug in my code for identifying top and bottom nodes in a connected component. I was ignoring null instant nodes and so it was leading to cycles in the results.