refactoring of  the database model