updated the functions

updated the functions to submit the programming assignment