Refactor: Localize variables