More code simplifications and proper use of datetime objects.