minor changes

made the code more flexible and now allow for the user to supply a
database context that already exists.