Update with if loop