detection loops merged

basic loop and 1.5,3,4 loop merged