long overdue utils.ip cleanup and optimization