Fix function according to description