Program now runs without any (significant) errors

Averaging is weird and I had to cut the arrays a little bit, and only
run the loop once. Scaled ivar values are super weird, why? But...it
works!(?)