An apparatus to transfer gas to or from a liquid has a flexible and oxygen permeable
but liquid water impermeable membrane, a flexible and gas permeable spacer, an
inlet conduit, an outlet conduit and a non-rigid restrain system. When used for
treating wastewater, an aerobic biofilm is culture adjacent the planar elements,
an anoxic biofilm is cultivated adjacent the aerobic biofilm and the wastewater
is maintained in an anaerobic state. A first reactor for treating wastewater has
an anaerobic section, a plurality of gas transfer membrane modules, and an aerobic
section. A biofilm is cultivated on the surface of the gas transfer membranes in
fluid communication with the anaerobic section. Biological reduction of COD, BOD,
nitrogen and phosphorous are achieved. In a second reactor, phosphorous is also
removed chemically in a precipitation branch.