Break out AJAX and WebSocket sections into functions
Break out functions from new game dialog
Fix tests