making it parallel with detach (and minor fixes to avoid some initial errors)