First portion of js refactoring.
Server code refactoring almost done.
Merge branch 'master' of https://github.com/daletskiy/tbs