Added template code from index; kept old stuff to double-check grid