Refined code for Context Action Mode