Added scratch memory helpers.