Changed isLeaf() to isGroup() and reversed all of the boolean statements
to reflect the change in meaning.