Essential changes

I've fixed all the problems with your code -- please pull in the changes ASAP.