Cleaned up and commented CountShortestPaths