isInside rewritten