relay-node: stick closer to RFC

* also minor code refactoring