Fixed socket communications.
Improved Bluetooth code and modularized testing based on communication type.