Added asserts and made the database location a parameter.

Added asserts and made the database location a parameter.