added new swithc code to the fade demo