improve savehlstoplaylist

this pull request helps keep track of changes while improving savehlstopplaylist

it contains a rewrite of the said funtion as well as improvements to the tests to keep track of runtime/errror handling improvements