Implement priority based clearsnippets.

Implement priority-based clearsnippets and add corresponding test cases (#335).
I do not understand the comment. Should that maybe be two method for clarity?