restored != null for checking null and undefined, tabulation fixed, function statement changed to function expression