Extract the foraging rules up into a separate function