Cleaned up some socket code, fixed tabbing