JS Code Cleanup; Client/Server connection code improvements; Improved connection life time events