shell: refactoring _context