remove unused import
clean up get_end and add noise return value
move segment list to sub-templates