Add new code for detaching things