Updated to be able to pass agent object and userAgent string
Fixed bug where options weren't processed