preparing popup functionality