cleaned up the date checking