refactored a bit, made 'this' be the same everywher in the render function, fixed escaping bug for script and style tag