edit snippet function