added multi-db support