optimize popup and datepicker