Moved inet_ntop code into separate function