Changes in logic to handle case for existing records.