rewrite of code required for html 5