update the logic