removed jquery and added templating function