Partially revert the changes I made in r233473 to keep the code concise.