Done addnic and detachnic func