code adjust to further encapsulate each invokation of the fruit gathering function