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