datepicker works and refactored some stuff