Added code for replacing NAs