rewrite switch