Use Template.registerHelper instead of deprecated UI.registerHelper
Move particles code into its own space