Added validateip function