slight refactor, fix JWS authentication