Refactor to use boundaries
wip