Changed binary tree routines to use cell pointers instead of cell ids