Adding my version of the 2nd task, containing 4 functions, as described in the README file.