The posted code mixes usage of local variables and class instance variables making it very confusing on where the real values are that the methods are computing.