refactor to allow for makefile building and requiring module externally