fix infix replace
add tree implementation