fix tree building and add exact search
exact search implemented