implemented javascript templating