Code refactoring.
Refactor client js to modules. Add requirejs and mocha for tests.