refactoring done in database classes.