Clean up popup window code
Fix small issue with popup.js