Refactored a lot with network wrapper