Make code cleaner and fix type error
Merge pull request #27 from drybjed/fix-ipaddr

Make code cleaner and fix type error