lines 186, 187, don't use x.present? here it will fail when x is nil..just 'if x' will suffice