Ip validation in more modern way + tests