ugly network wrapper code