Cleanup on deactivation

To avoid conflicting with my other pull requests, this branch was branched off of my enable_ie_support branch. Check the last commit for changes related to this pull request.
Can you extract the var isBlockGroup out of the if block (this happens anyway as there is no block scope) and simply have an else if condition on that?