move spec generation into private function