Reorganizing JS, but some popovers not working