Factored out some loose functions.

The functions that used to support __main.php are moved to a
BreathableAir class.