Function revised following example