Refactored Network.hs