work on trees and sorting