cleaned up datepicker code