fist fully refactored version of thjs to telehash-js