third version of functions.rb