Eliminate duplicated setContext() calls which are expensive