public function main($content, $conf)
    {
        $this->templateService = GeneralUtility::makeInstance(MarkerBasedTemplateService::class);
        $this->init($conf);
        $singleSelection = $this->getSingleRecords();
        $groupSelection = $this->getRecordsFromGroups();

        $templateCode = $this->getTemplate();

        // apply sorting
        $addresses = $this->sortAddresses($singleSelection, $groupSelection);

        // limit output to max listMaxItems addresses
        if (((int)$this->conf['listMaxItems']) > 0) {
            $addresses = array_slice($addresses, 0, (int)$this->conf['listMaxItems']);
        }

        // output
        foreach ($addresses as $address) {
            if (!empty($address)) {
                $markerArray = $this->getItemMarkerArray($address);
                $subpartArray = $this->getSubpartArray($templateCode, $markerArray, $address);

                $addressContent = $this->templateService->substituteMarkerArrayCached(
                    $templateCode,
                    $markerArray,
                    $subpartArray
                );

                $wrap = $this->conf['templates.'][$this->conf['templateName'] . '.']['wrap'];
                $content .= $this->cObj->wrap($addressContent, $wrap);
                $content .= LF . LF;
            }
        }

        $templateAllWrap = $this->conf['templates.'][$this->conf['templateName'] . '.']['allWrap'];
        $content = $this->cObj->wrap($content, $templateAllWrap);

        $content = $this->cObj->wrap($content, $this->conf['wrap']);

        return $this->pi_wrapInBaseClass($content);
    }