Further optimize tree leaf and root placing