custom relay logic