writing tools, tree function from origin