Fixed bugs

Removed function keyword for more portability
Made it work without -6

This code still fragile, it doesn't play well with differently formatted /etc/hosts