* Check if the local DB exists. Create a new one only if none was found.
* A bit of refactoring.