add package.json for easy `npm install`
rename functions and comments for clarity