Adding changes to relay.c