Code clean-up and renaming of variables. TCP communication fix.