Tidied up.
Moved the popup to its own template file.