large changes to support deep comparison