add binary tree, optimize, improve unit tests