Rearrange code.
Add basic test case for JWS.