Removing an unnecessary variable and deleting logging code