First version of db class