Add more comments to logic.php