updating the variables after checking guards