merge new database code, fixes #9
moved files to dir bin/