added check for fully inside vs. only outside