Replace bogus value in map which referred to wrong template.
Fix references to popup
Don't use dastardly javascript for/in loop construct