Reorder some functions
Add alert() to C code
Connect PendingRequests
Some more logic to connection state