refactors code to use Embed DB.