First commit, working as intended. Really needs tests and refactoring of transports.