Refactored debug + socket plugins to work together