A rigorous approach to study kinetic and 3D effects on resistive wall mode