Refactored to keep logic inside socket mod instead of server mod