Made connection handler generic