function created and corrected
function created and corrected 2