Add error handling using Maybe to network-related functions