removed the use of isFunction and isNullOrUndefined