Fix the search for enabled items so it looks nearby before further away and so it does not depend on the loop setting.