refactored template render function to return document fragment. Refactored example html file