Separated the connection task to new class
Code clean-up