Moved the entire measure mean extraction into an if statement check to prevent all of that code from running when it doesn't have to.