refactored the datepicker to make it more friendly