Added tests for double registration and token validation and expiry
Merged changes from JP