Electronic spectra of carbazole, dibenzofuran and dibenzothiophene