Style changes.

Unified variable names, missing semicolons, clearer function names.
Moving files around.
Package definition style.
Moved methods documentation to lib.

API should be the same on client and server, so we can document methods
in one place. A bit changed callback APIs.
Cleaning client side code. Unifying style.
Unifying tests.
Simplified tests.