Do not use local variables. You are causing race conditions (you might be reading new data or old, no way to tell and it could be changing per iteration and therefore messing up your calculations). Use DATAFLOW (ie wires) to pass your values from one calculation to the next.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions Unofficial Forum Rules and Guidelines "Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5