Refactored connection and introduced interfaces for assoc resolver and writer.