Added missing semi colons. Fixed compares to use !== and ===. Put the options in a closure