Issue #18 : Refactored createPopup function.