created recursive functions for list, cleaning up tree