updated readTree to return provided tree