implemented detach method