updated getboundaries
refactored a bit, wired it up