updated so all tree methods are in tree and added unit testing