Add tree adding functionality.