Fix HTML template and do some fwd-portings

Tested working. Closes #25.

@steveklabnik