Empty arrays are transformed to Maps and have therefore be created as List objects specifically
Switched to saveHTML for output
Fixes for handling UTF-8 encoding and not adding <html><body> if not present in input