A unitary isobar model for pion photo- and electroproduction on the proton up to 1 GeV