Added the function to control the relay.
corrected indentation