Update cmp fuction