relay: simplify code