refactoring
towards HTML5 UI: events packed with JSON instead of cPickle