The evolution of nitrogen cycling