Import text_socket explicitly only where it is required
Remove unused import