Changed static variable values and made loopvariable local