Title: Theory and Computation of Electromagnetic Fields in Layered Media