Connection code.