added the functionality to preserve formating of existing template