connecting moved under exception handling in case application cannot connect