Add mechanism for detecting current execution mode