Added code for connectivity. This is still work in progress.