Refactor db connected classes.