Modify functions to Programming Assignment 2 specifications