Reworked the function to avoid copying dataset (actually makes it faster)
Step 2: extracted mean and sd columns only
Commented where steps 1-4 happen
Summary dataset written