added code for solenoid, tested and it all works