Error checking is more simple.
socketDescriptor is now global;
Added a global index (int i) to use in for loops, as apposed to declaring one
for every loop.