Refactor index.html and main.html