Function corrected.

Function corrected