Tidied up html/index.php

You're going to hate this :(

I've tidied up html/index.php, both code formatting and old code that needed to be removed.

I realise that I could have probably submitted PR's for code removal and code cleanup separately but a lot of the code needs tidying up and I'd prefer to just get through it to be able to work on other things rather than making the PR's easier.