Replaced if-else with fnil