moves openDB function