Now the maximumTree function works!