Really broken date switch. Rewriting
Correct switching. This stuff should have normalized dates and large refactoring, but later
Error catching