changed instance variables into local variables