Alter 'ip' to unique key
Add get_hostname, cleanup logic