Functional html rendering function