Added support for using multiple databases