Script to detach