A method of producing a hydrocarbon raffinate having reduced levels of heteroatom compounds and 2-4 cycle polynuclear aromatic hydrocarbons, the method comprising: providing a hydrocarbon feedstock containing crude oil fractions with a boiling point range of from 165 °C to 430 °C, the crude oil fractions comprising heteroatom compounds and 2-4 cycle polynuclear aromatic hydrocarbons; extracting, in at least one extraction vessel of a heteroatom extraction system, at least a portion of the heteroatom compounds from the hydrocarbon feedstock with a tunable solvent which selectively dissolves or forms complexes with heteroatom compounds from the hydrocarbon phase, to form at least one heteroatom-compound rich stream containing heteroatom compounds and a heteroatom-compound lean stream containing the 2-4 cycle polynuclear aromatic hydrocarbons, the tunable solvent comprising an ionic liquid formed from pressurized carbon dioxide and water; and extracting the 2-4 cycle polynuclear aromatic hydrocarbons from the heteroatom-compound lean stream with a solvent system to form the hydrocarbon raffinate, the solvent system comprising an aprotic solvent, wherein extracting at least a portion of the heteroatom compounds from the hydrocarbon feedstock comprises: extracting from the hydrocarbon feedstock a first portion of the heteroatom compounds having a first polarity to form a first heteroatom-compound rich stream and a first heteroatom-compound lean stream, the first portion of the heteroatom compounds being extracted in a first extraction vessel of the heteroatom extraction system operating at a first pressure, the first heteroatom-compound rich stream containing the tunable solvent; extracting from the first heteroatom-compound lean stream a second portion of the heteroatom compounds having a second polarity lower than the first polarity to form a second heteroatom-compound rich stream and a second heteroatom-compound lean stream, the second portion of the heteroatom compounds being extracted in a second extraction vessel of the heteroatom extraction system operating at a second pressure higher than the first pressure after extracting the first portion of the heteroatom compounds, the second heteroatom-compound rich stream containing the tunable solvent; and extracting from the second heteroatom-compound lean stream a third portion of the heteroatom compounds having a third polarity lower than the second polarity to form the heteroatom-compound lean stream and a third heteroatom-compound rich stream, the third portion of the heteroatom compounds being extracted in a third extraction vessel of the heteroatom extraction system operating at a third pressure greater than the first pressure and the second pressure after extracting the second portion of the heteroatom compounds, the third heteroatom-compound rich stream containing the tunable solvent. providing a hydrocarbon feedstock containing crude oil fractions with a boiling point range of from 165 °C to 430 °C, the crude oil fractions comprising heteroatom compounds and 2-4 cycle polynuclear aromatic hydrocarbons; extracting, in at least one extraction vessel of a heteroatom extraction system, at least a portion of the heteroatom compounds from the hydrocarbon feedstock with a tunable solvent which selectively dissolves or forms complexes with heteroatom compounds from the hydrocarbon phase, to form at least one heteroatom-compound rich stream containing heteroatom compounds and a heteroatom-compound lean stream containing the 2-4 cycle polynuclear aromatic hydrocarbons, the tunable solvent comprising an ionic liquid formed from pressurized carbon dioxide and water; and extracting the 2-4 cycle polynuclear aromatic hydrocarbons from the heteroatom-compound lean stream with a solvent system to form the hydrocarbon raffinate, the solvent system comprising an aprotic solvent, extracting from the hydrocarbon feedstock a first portion of the heteroatom compounds having a first polarity to form a first heteroatom-compound rich stream and a first heteroatom-compound lean stream, the first portion of the heteroatom compounds being extracted in a first extraction vessel of the heteroatom extraction system operating at a first pressure, the first heteroatom-compound rich stream containing the tunable solvent; extracting from the first heteroatom-compound lean stream a second portion of the heteroatom compounds having a second polarity lower than the first polarity to form a second heteroatom-compound rich stream and a second heteroatom-compound lean stream, the second portion of the heteroatom compounds being extracted in a second extraction vessel of the heteroatom extraction system operating at a second pressure higher than the first pressure after extracting the first portion of the heteroatom compounds, the second heteroatom-compound rich stream containing the tunable solvent; and extracting from the second heteroatom-compound lean stream a third portion of the heteroatom compounds having a third polarity lower than the second polarity to form the heteroatom-compound lean stream and a third heteroatom-compound rich stream, the third portion of the heteroatom compounds being extracted in a third extraction vessel of the heteroatom extraction system operating at a third pressure greater than the first pressure and the second pressure after extracting the second portion of the heteroatom compounds, the third heteroatom-compound rich stream containing the tunable solvent.