Code for blocking dead end paths.