separated connection handler into separate source file