Trying to understand the logic