improved binary tree class