Use for-else instead of preserving bollean status in p007