db auth and util refactoring