Replacing alerts with popups