Make tree work for any size