Allow root option to be provided

Changes the API to allow an options object to be specified