mild refactor for better naming and convenience
introduce a scratch context for non-persistent cases; also mild refactor of interface