Modify the logic of the code here