Added first draft of relay control