Rewrote the IdP to be more OO then F.