Tree sort first attempt. (need to fix)