Change instance variables to locals where possible