added new relay code