Popup template cleanup