Merge "Optimize variance functions" into experimental