Changing some code to remove some nans