refactor database adapters