CGI endpoint rewrite

There is still a fair bit to do. I'm shoving it here so it can't be forgotten
about and so that it's in another place than just my laptop.