Added option to compareAndAdjust to allow only same or nonsame relations