Major  updates to function and template files

remove jQuery local