refactor isContext

To a more sensible scheme.