Refactor database adapter loading