First changes to logic.php