Added directory and fixed a couple of template bugs