replace instance variables with local variables