Fix NetLib rename references
Refactor while loop into do-while