Atoms in an optical cavity: quantum electrodynamics in confined space