modularized for npm