added detaching option