Update for Scala 2.10.1
Implement balance function
Implment countChange function