Updating functions to complete assignment 2.