very minor changes to Tim's master stroke