Refactor for HTML 5