added multiple database support