updated functions to complete assignment