fourth version of functions.rb