Correct typo, remove unnecessary try-catch block
Simplify IP validation/conversion functions