preliminary snap function with detection