Start cleaning up: separate network functions
Separate mark buffer as read stuff
Separate file for handling messages