find single XPath by index + code cleanup