TECHNOLOGY FOCUS - CHEMICAL ENGINEERING - Preferred Process: The gas stream is compressed before passing into MU1. Portion(s) of PS1 are passed as fuel into combustion zone of gas engine driving a compressor in which the gas stream is compressed. PS2 is recompressed and recirculated into MU1. The gas stream is cooled by heat exchange against at least one of the permeate streams before passing into MU1. PS1 is passed to additional membrane separation stage. PS2 or gas stream passes through a compression step before passing into MU1. The process further involves providing a membrane unit (MU3) connected in series with MU1, passing PS1 into MU3 and across feed side (F3), withdrawing residue stream (RS3) enriched in CH4 from F3 and withdrawing permeate stream (PS3) depleted in CH4 and enriched in N2 and CO2 from permeate side (P3) at pressure (p4) lower than p1. Alternatively, the process involves providing membrane unit (MU4) in series MU3 such that gas leaving PS3 enters MU4. Residue stream (RS4) enriched in CH4 is withdrawn and recirculated as a feed to MU3 and permeate stream (PS4) enriched in N2 and CO2 is withdrawn from permeate side (P4).Preferred Conditions: The gas stream is cooled to between 25degreesC and -25degreesC.Preferred Composition: The gas stream comprises natural gas, 10% N2, 5% CO2, H2S and water vapor. The product stream contains not more than 4% N2, not more than 2% CO2, not more than 4 ppm H2S and not more than 140 ppm water vapor. The product stream contains at least about 70% of CH4 of the gas stream.    TECHNOLOGY FOCUS - POLYMERS - Preferred Membrane: Membrane (M1, M2) comprises polymer repeating units of fluorinated, non-aromatic ring structure with at least 5 components and has fractional free volume of not more than 0.3. M2 exhibits selectivity for N2 over CH4, of at least 2. EXAMPLE - Raw gas containing 75% methane (CH4), 15% nitrogen (N2), 9.9% carbon dioxide (CO2), 0.1% water vapor and 100 ppm hydrogen sulfide (H2S) at 200 psia and 20 degrees C was compressed to 1200 psia and passed into membrane unit. Residue stream containing 18.3 mol% of N2, 79.8 mol% of CH4, 1.9 mol% of CO2, 175 ppm of water vapor and 19 ppm of H2S was withdrawn. The removal process yielded product stream containing 4 mol% of N2, 96 mol% of CH4 and 19 ppm of CO2.