Add reference counting for client