Added validation for date
Code cleanup