Add indexes and other stuff
Reorganize templates