When the heat energy of the gas is extracted—for example, by having the gas push against a piston—the bits are left behind. The moving piston turns heat energy into mechanical energy, the energy per atom (and hence per bit), decreases, and the expanding gas cools down. As long as the temperature of the gas does not go to absolute zero, each atom (and hence each of its bits) still requires some energy, so that amount of energy must remain in the gas, rather than becoming mechanical energy. Since some energy must remain behind, not all of the energy can be extracted in the form of work.