Transmission and reflection of electromagnetic waves in the presence of stratified media