Cast String to Date. Added test.
Minor changes.