fixed logic error with valid dates, added leap year checker