Modified mean/sd calc to iterate (uses less memory)

Since it uses less memory, the code can actually be run on my local
machine now.