Added popups on click
refactored popup code