------------------------------------------ The original EGS4 implementation in FLUKA was progressively modified, substituded with new algorithms and increasingly integrated with the hadronic and the muon components of FLUKA, giving rise to a very different code, called EMF (Electro-Magnetic-Fluka). In 2005, the last remaining EGS routine has been eliminated, although some of the structures still remind of the original EGS4 implementation. The main developments were made according to the following sequence. The Ferrari-Sala multiple scattering algorithm was the first major addition in 1989. It has already been described elsewhere since it was applied to hadrons and muons as well. Following its implementation, the whole electron/positron transport algorithm had to be reworked from scratch in order to comply with the features (initial and final step deflections, complex boundary crossing algorithm) of the new model. In 1990, the treatment of photoelectric effect was completely changed. Shell-by-shell cross sections were implemented, the photoelectron angular distribution [Sau31] was added, taking into account the fine structure of the edges, and production of fluorescence X-rays was implemented. Many new features were added in 1991. The emission angle of pair-produced electron and positrons and that of bremsstrahlung photons, which were only crudely approximated in the original EGS4 code, were now sampled from the actual physical distributions. The full set of the electron-nucleus and electron-electron bremsstrahlung cross sections, differential in photon energy and angle, published by Seltzer and Berger for all elements up to 10 GeV [Sel86] was tabulated in extended form and introduced into the code together with a brand new sampling scheme by Fasso` and Ferrari. The energy mesh was concentrated, especially near the photon spectrum tip, and the maximum energy was extended to higher energies. The Landau-Pomeranchuk-Migdal effect [Lan53,Lan53a,Mig56,Mig57] for bremsstrahlung and the Ter-Mikaelyan polarisation effect [Ter54] (suppressing soft photon emission) were implemented. Positron bremsstrahlung was treated separately, using below 50 MeV the scaling function for the radiation integral given by Kim [Kim86] and differential cross sections obtained by fitting proper analytical formulae to numerical results of Feng et al. The photon angular distribution was obtained by sampling the emission angle from the double differential formula reported by Koch and Motz [Koc59], fully correlated with the photon energy sampled from the Seltzer-Berger distributions. The Compton effect routines were rewritten in 1993 by Ferrari and Luca Cozzi (University of Milan), including binding effects. At the end of the same year, the effect of photon polarisation was introduced for Compton, Rayleigh and photoelectric interactions by Ferrari. In 1993 and 1994, A. Fasso` and A. Ferrari implemented photonuclear reactions over the whole energy range, opening the way to the use of Monte Carlo in the design of electron accelerator shielding [Fas94]. Giant Dipole Resonance, Delta Resonance and high-energy photonuclear total cross sections were compiled from published data [Fas98] (further updated in 2000 and 2002), while the quasideuteron cross section was calculated according to the Levinger model, with the Levinger's constant taken from Tavares et al. [Tav92], and the damping factor according to Chadwick et al. [Cha91]. The photon interaction with the nucleus was handled in the frame of the FLUKA hadronic event generators PEANUT and DPM (see below). In 1995, a single Coulomb scattering option was made available for electrons and positrons by Ferrari and Sala. The aim of this option was mainly to eliminate some artefacts which affected the angular distributions of charged particles crossing a boundary, but it turned out very useful also to solve some problems at very low electron energy or with materials of low density (gases). In the same year, the electron transport algorithm was reworked once more by Ferrari and Sala introducing an adaptive scheme which "senses" close boundaries in advance and automatically adapts the step length depending on their distance. Also in 1995 Ferrari discovered that the EGS4 implementation of M{ö}ller and Bhabha scattering, still used at that time in FLUKA, was flawed. The bug was duly reported to the EGS4 authors who took corrective actions on their own code, while Ferrari developed a new algorithm for M{ö}ller and Bhabha scattering for FLUKA. In 1997 mutual polarisation of photons emitted in positron annihilation at rest was introduced by Ferrari. Cherenkov photon production and optical photon transport was implemented in 1999 by Ferrari. In 2002 scintillation photon production was added as well. In 1998-2001 an improved version of the Ferrari-Sala multiple scattering model was developed, introducing further refinements and the so called "polygonal" step approach. This version is presently fully tested offline and will be soon introduced into the production code. In 2005, the need for an external data preprocessor has been eliminated, integrating all the needed functionalities into the FLUKA initialization stage. At the same time, data from the EPDL97 [EPDL97] photon data library have become the source for pair production, photoelectric and total coherent cross section tabulations, as well as for atomic form factor data. At the same time, Rayleigh scattering has been reworked from scratch by Ferrari with a novel approach, and the photoeletric interaction model have been further improved with respect to the 1993 Ferrari-Sala approach, extending it among the others down to a few eV's. Finally the energy sampling for pair production have been completely reworked by Ferrari using a vastly superior approach, which can distinguish between interactions in the nuclear or electron field, and properly sample the element in a compound or mixture on which the interaction is going to occur. Thew algorithm is also capable of producing meaningful results for photon energies close to thresholds where several corrections are important and the symmetry electron/positron is broken, insimilar fashion to the bremsstrahlung case.