refactored nodes into protocol and separated into own package. refactored logic into own package