Some comment for this logic would be appreciated.