updated compare code