Database now checks for existence

Also updated char buffers to be global and reusable.
Minor refactoring.
Further changes around app delegate related to testing
head exploding from all this asynchronousy….