Found a better way to do snapping