Added functionality for main.php to validate equations before saving them.