Updated templates and javascript to be used from different contexts
other than root.