Added count() to know num of connected components