Added update/insert detection