Move irrelevant code out of toolbar hiding