refactoring of database framework