Modified function snippet