I understand, thank you very much for your responses. The reasoning behind this was that I am trying to control a solenoid and two DC motors, with direction switching, using only the 6 relay outputs. Simplified to clarify, motor 1 may be controlled by outputs 0 and 1, then motor 2 may be controlled by outputs 1 and 2, so pressing one button would set Os 0 and 1 and another button would set Os 1 and 2. I have ended up just splitting the two functions into different sub routines, rather than controlling everything from one screen.