Works more or less okay except a giant bug that causes all communications to stop forever. Next commit should resolve this.