moved code around for npm
continued move