worked on popup function