implement switch and add callback for it;