Added logic for dates