Many areas simplified, unnecessary switch-blocks removed, expand_tree() and contract_tree() methods added.