changing pass by value to pass by reference