Rewrote pragma handling to be more modular.