Improved snippets logic