improving templates and adding some javascript/jquery