Custom switches - how to code them?