reimplementing that network lib