Improved multi-instance management. Fixes issue #12