now working with popup window