made fog connection reusable function.
made fog connection reusable function.