updated switch control and led control