Adjust control code and add html5 support