added snap to functionality