Breaking apart snapping code.