working implementation of the ecabo protocol, not made to be pretty!