Lost Connection Recovery

- Added procedures to automatically reconnected to SQL server.
- Touch of cleanup