WIP refactoring more code into twisted style