This might be worth reading

http://blog.sigfpe.com/2011/10/quick-and-dirty-reinversion-of-control.html