Some work I did a while back working through http://www.cis.upenn.edu/~bcpierce/sf/