Refactoring for const correctness