major refactor to more of an npm module style codebase