Clean-up
Refactor for readability
Implement wait for ongoing XHR to finish before HTML is rendered when JavaScript execution is enabled