Tidy up and tests. Also added in checking for issuer, audience and fixed up issues with expiry and clock skew