WIP improve error-html message formatting code