update logic for if statement