refactored getBoundaries() to do it the way Dr. Jumadinova does it

(I feel kinda dumb now)