add support for scratch memory