Cleaned up some messiness; previous version referred to variables that no longer existed.  Sorry.