Use newly exposed Engine function to read XML templates.

Clean up of some code. Make code adhere to the coding style.