Renamed stdname to term in queries.
Added context_prev() to undo functions (untested).