Move init code to HTML page