Modular method for calculation of transmission and reflection in multilayered structures.