First version of the function for this assignment