Refactor to add support to multiple connection implementations