Added template read/write plugin code. Modified all plugin write sides
to use template code where applicable, for a fair comparison.