remodeled the database internals