add switch usage, but also introduced unsafe usage of document.writer()