Port to HTML

The changes required to get the HTML port working.