restructured the way the connection threads operate, fixed some really stupid code errors