refactoring and getting ready to upload to npm