scripts/index.py: Code cleanup and make HTML formatting a little nicer