implemented the popup functionality (not tested yet)