split db access into two files
little refactorings
 line endings and spelling