Some changes to constructDiscretization.