Updates to better handle malformed data, removed isConnected and added socket data buffering