binary tree working and sorts to array