Used named inner classes in createTemplate

Instead of creating anonymous inner classes use named inner classes in the createTemplate method.
This change reduces memory usage by:
Reducing the number of classes defined to only 2 instead of 2 per page
Causing the pageCache to not hold a transitive reference to the Callable class, allowing it to be garbage collected

See MACKNZ0005-8512