Not really a fan of using one helper to do all the logic that the template can do. I think it would be best to follow suite with other plugin implementations and wrap this is a block helper that organizes the data, returns it in a more manageable form and then lets the template figure out what to do with some `{{#if}}`'s.

That way the template is much more telling of what is going on and what the result should like like. Also we'd prevent writing any JavaScript from building HTML strings.