changed implementation for CountDiv
added implementation for Brackets and Nesting