BS-2575, extract code for get first executable elements