moved stop flag into module