Pulled all calculations out of callback. Now it minimally only sets a flag.

Untested.