A precise method for solving wave propagation problems in layered anisotropic media