cleaning up input data and adding the ability to use PA records provided explicitly at runtime.