relay: minor refactoring