A numerically improved computational scheme for the optical conductivity tensor in layered systems