replaced assignment with a conditional operator for nil