updating switcher jQuery plugin to make it more unit testable