Fixed up main.php.  Still a work in progress.