Tree commands refactor