split connection API into iternal and external