accept tree object as its first argument

close #3