added (very basic) test, and used it to get binary tree working
shuffled around stuff to fix edge cases found by astar