added === and !== where it should be, change typeof "undefined" to === undefined ...