Get rid of db dependencies on main