Add MinMaxTree, change structure of main for test