Refactored into using synchronous socket communication.