adding initial implemenation of fn for correcting data errors