Finished the pgUpdate function and added a new input argument