now uses underscore templates for selection replacement