Streamlining code, significantly reducing code size. Adding error message if `getAddrInfo` returns an empty list. Explicit imports for clarity. Minor spelling corrections.