Modal disconnect

Fixes #598