calculate targets once, add crash handler