Merged with Chris' modifications to Scratch.