refactoring of CLI/Twistd