Restructure to pass html validation and cleanup