Small fixes and improvements to HTML snippet functions