Remove the type prefix and fix some inconsisten use of jtype in api.
Rudimentary login/logout state detection.