implemented midpoint snap