Refactor the db_mapper