refine relay.php