The electronic structure of adsorbed aromatic molecules: Perylene and PTCDA on Si(111) and Ag(111)