Refactor
Updated for npm