Refactored DidEnterRegion function