Relay Simplification

Reduced complexity in the main loop.  Methods to determine whether the
relay can turn on or off are embedded in their functions.