Implements deep structure comparison