refactoring of commonDB. adding errors everywhere.