Refactor pointer parameter to be pass by reference parameter