added Connection type, added disconnect function