first update by Mike, modify main.php