added docs, better logging for IP address resolution
updated comments and formatting