Some more fixes. Not done yet. Will be an easier way to do this....
Pre-process most date values, parameter typo fix and add ifDatabaseExists check.
Confirm existence of database before doing work.