Refactoring ContextCaster