Add select all/none functionality, modularized the templates a little bit