refactored some things
added custom connections and protocols
cleaned up some code