construct trees