Improve snap code