Changed ifTrue and ifFalse to when and unless