added cord snapping