Improve ContextManager