implementing popup function