refactored interfaces, introduce connection lib