refactoring to prepare npm