Try restarting connection if it is dropped at some point
Added s3 support