Updated the template functions to support storing complex types as their data only, to minimise their size in JSON, with the option of keeping everything, if required