Refactor operations with connection API