Move content handling logic out of #refresh.