It's in the interest of the farmer to kill the animal swiftly because of what musajen said before.
Coming up with a cost-effective way of improvement of living conditions is more complicated due to the huge price difference between grain an grass fed. But that might change due to the advantage of local production due to their smaller environmental footprint.
In theory, as companies are held more accountable for their environmental and social performance (CAFO facilities have very big impacts), there could be a significant incentive to go more local and thus greener. Removing the subsidies for corn and other cereals would help enormously as well.
“Every saint has a past and every sinner has a future.” -Oscar Wilde
"The power of accurate observation is commonly called cynicism by those who have not got it." -George Bernard Shaw
"The trouble with jogging is that the ice falls out of your glass." -Martin Mull