Added more to js code and edits to template