Added mean/standard deviation extraction and subsetting logic.