Reworked, incl. correct handling of optional vs. required attributes and htsp version handling.