Can you verify that this logic is correct?