Add compareTo and addChild methods and relevant test cases