Improvements to boundary intersection checking.