Refactoring for npm publishing