refactor local variables