Refactor: Use reference instead of pointer