Updated templates with template extension

I also fixed a dispaly bug if there were two books and made it so that
add glossary items works.