D.R.Y.ed processing of elements disconnection.
Added state change handling to the single wlakthrough algorithm. Added one more test.