Corrected object variable scoping