Endpoint migration to twisted

WIP: DO NOT MERGE YET