Check validation flag instead of hardcoding rules
Fix spaces in subscript and superscript