added print controller function, removed indent of index function
added template support for print function