Code cleanup (roughly ReSharper-driven).
Additional signature for Date function added.
Merge with upstream, fixed conflicts