Added reconnection feature & minor fixes