removing unused imports
adding expandvars call
more comprehensive setup for db.uri