moved the range object calculation outside of the boundary function