refactoring for npm