Refactoring TCP connection management process (WIP)