Refactoring to replace last few var declarations with const.