Update for the latest trunk changes and to use the changes from bug 852777. Scratchpad non-functional for now.