adding a better system when popup closes and calendar finetuning