Moving the global muting logic to a shared helper method

Sorry, had to re-issue the pull request.. Had the wrong email/user on the commit.

Thanks

(Keep it up, btw, this project is awesome)