Some refactoring and js module initialized