Browserify. Refactoring. Add tests