Put some of the code into a private function.