Fix Datetime extensions bug, improve code coverage and cleanup code based on SonarQube results