Minor optimization by removing function to calculate mean
Version 1.1.1