Improve tests and Datetime handling