Quote Originally Posted by simonsayz27 View Post
I passed in, by reference, a variable "sum" and set it to 0...
This actually fixes an error in your original code: it would accumulate that total over multiple calls (never resets depthTotal to 0).