Adapted to changes in context scoping.