Fixed usage of various templating functions. Removed deprecated functions.