deleted stop bool and fixed logic
removed stop bool